package miracle.joker.design.bridge;

public class CarFactory {
    public AbstractCar createCar(String type, Engine engine) {
        AbstractCar car;
        if (type.equalsIgnoreCase("Sedan")) {
            car = new Sedan(engine);
        } else if (type.equalsIgnoreCase("Hatchback")) {
            car = new Hatchback(engine);
        } else {
            throw new IllegalArgumentException("Invalid Car Type");
        }
        return car;
    }
}
